package controllers

import (
	"github.com/emicklei/go-restful/v3"
	"github.com/rs/zerolog/log"
	"webGoDemo/model"
	"webGoDemo/services/record"
)

func List(request *restful.Request, response *restful.Response) {

	log.Info().Msg("in controller  层 。。。record。。。")
	recordService := new(record.LogicRecordService)
	pageRequest, err := model.GetPageRequest(request)
	records, err := recordService.ListRecords(pageRequest)
	if err != nil {
		panic("查询出错")
	}
	err = response.WriteAsJson(records)
	if err != nil {
		panic("写入页面出错")
	}
}
